package com.richapp.launcher.net;


import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * Created by jack on 15/10/2.
 */
public class MessageIdManager {
    /**
     * 消息ID队列中存储容量
     */
    private static int countMax = 1000;

    private static ConcurrentLinkedQueue<String> messageIdQueue = new ConcurrentLinkedQueue<String>();

    private MessageIdManager(){

    }

    public static void addMsgId(String msgId){
        if(messageIdQueue.size()+1 > countMax){
            messageIdQueue.poll();
        }

        messageIdQueue.add(msgId);
    }

    public static boolean contansMsgId(String msgId){
        boolean flag = false;

        flag = messageIdQueue.contains(msgId);
        return flag;
    }
}
